package com.jinkeen.xiaxie.anim

import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.util.AttributeSet
import android.view.View
import java.util.jar.Attributes

class Anim : View {

    private val radius: Float = 100f
    private var mPaint: Paint = Paint()
    private var color = "#FF00000"

    constructor(context: Context) : this(context, null)
    constructor(context: Context, attributeset: AttributeSet?) : this(context, attributeset, 0)
    constructor(context: Context, attributeset: AttributeSet?, attrrs: Int) : super(
        context,
        attributeset,
        attrrs
    ) {
        mPaint.setColor(Color.BLUE)
    }

    fun setColor(color:String){
        this.color=color
        mPaint.setColor(Color.parseColor(color))
        invalidate()
    }

    fun getColor():String{
        return color
    }

    override fun onDraw(canvas: Canvas?) {
        canvas!!.drawCircle(500f,500f,radius,mPaint)
    }
}
